package tv.athena.live.api.activitybar

import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.Observer
import tv.athena.live.api.activitybar.bean.ActivityBarConfig
import tv.athena.live.api.activitybar.bean.BroadcastData
import tv.athena.live.api.activitybar.bean.EntryData
import tv.athena.live.base.arch.IComponentApi

/**
 * @author baiting
 */
interface ActivityBarApi : IComponentApi {
    /**
     * 显示
     * @param config
     */
    fun show(config: ActivityBarConfig?)

    /**
     * @param url
     * @param configUIJson ui配置json，格式如下：
     * {
     * isFullScreen: boolean ,
     * isShowTitle: boolean ,
     * style: int ,
     * width: int ,
     * height: int ,
     * gravity: String(BOTTOM,CENTER,TOP)
     * }
     */
    fun showPopView(url: String?, configUIJson: String?)
    val entryData: EntryData?

    /**
     * 关闭弹框
     */
    fun closePopView()

    /**
     * 观察数据变化
     * @param owner 生命周期
     * @param observer 绑定数据
     */
    fun observeBroadcastData(
            owner: LifecycleOwner?, observer: Observer<BroadcastData?>?
    )

    /**
     * 移除观察
     * @param observer
     */
    fun removeObserver(observer: Observer<BroadcastData?>?)

    /**
     * 加载js
     * @param js js
     */
    fun loadJavascript(js: String?)

    companion object {
        const val ACTIVITY_BAR_LAYOUT = "activity_bar_layout"
    }
}